package org.andao.commons.service;

import java.util.List;
import java.util.Map;

import org.andao.commons.model.Dictionary;
import org.andao.core.base.service.BaseService;
import org.andao.core.dao.helper.Page;
import org.andao.core.exception.ServiceException;




/** * 数据字典. 
 * 
 * @author Marco.hu(hzg139@163.com)
 */
public interface DictionaryService extends BaseService<Dictionary>{
	
	/**前缀key方式*/
	public final static String PREKEY_TYPE_BYNAME	= "byName";
	
	public final static String PREKEY_TYPE_BYCODE	= "byCode";
	
	/**
	 * 批量级联删除
	 * @param split
	 */
	void batchCascadeDelete(String[] split) throws ServiceException;
	
	/**
	 * 修改并更新缓存
	 * @param dictionary
	 */
	void updateDict(Dictionary dictionary,List<Dictionary> childs) throws ServiceException;

	
	/**
	 * 保存并更新缓存
	 * @param dictionary
	 */
	void saveDict(Dictionary dictionary) throws ServiceException;
	
	/**
	 * 单个删除
	 * @param dictId
	 * @throws ServiceException
	 */
	void deleteDict(String dictId) throws ServiceException;
	
	/**
	 * 根据查询条件找分页列表
	 * @param condition 条件
	 * @param page
	 * @return
	 */
	Page findDictionaryByCondition(Map<String,Object> condition,Page page) throws ServiceException;

	/**
	 * 根据字典编码，返回这个字典的所有key/value键值对
	 * @param dictCode
	 * @param isPreKey 是否需要设置key前缀
	 * @param prekeyType 前缀key设置方式：byName|byCode，按名字或按编码
	 * @return
	 * @throws ServiceException
	 */
	public Map<String, Object> getDictionByMap(List<String> dictCode,boolean isPreKey,String prekeyType) throws ServiceException;
	
}
